package com.jason.library.common.base

import android.widget.LinearLayout
import androidx.viewpager.widget.ViewPager
import com.google.android.material.tabs.TabLayout
import com.jason.library.common.R
import com.jason.library.common.adapter.CommonViewPagerAdapter

/**
 * @description: BaseTabActivity
 *
 * @author ChenBaoyang
 * @date 4/29/21 09:54
 */
abstract class BaseTabActivity : BaseActivity() {

    private lateinit var container: LinearLayout
    private lateinit var tabLayout: TabLayout
    private lateinit var viewPager: ViewPager
    protected lateinit var pagerAdapter: CommonViewPagerAdapter


    override fun beforeViewInit() {

    }

    override fun getLayoutId() = R.layout.common_activity_tab

    override fun initView() {
        container = findViewById(R.id.container)
        tabLayout = findViewById(R.id.tab_layout)
        viewPager = findViewById(R.id.view_pager)
        pagerAdapter = CommonViewPagerAdapter(supportFragmentManager)

        viewPager.adapter = pagerAdapter
        tabLayout.setupWithViewPager(viewPager)
    }

    override fun onDataInit() {

    }
}